<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>牛舍管理</title>
		<link href="css/new_file.css" rel="stylesheet" type="text/css">
		<link href="css/mui.min.css" rel="stylesheet" type="text/css">
		
		<script src="js/mui.min.js"></script>
		<script src="js/testActivityName.js"></script>
		<script src="js/echarts.min.js"></script>
		<script src="js/jquery-1.8.3.min.js"></script>
		<script src="js/mui.picker.min.js"></script>

		<script charset="UTF-8" src="js/config.js"></script>
		<script charset="UTF-8" src="js/testActivityName.js"></script>
		<script charset="UTF-8" src="js/core.js"></script>
		<script charset="UTF-8" src="js/cipher-core.js"></script>
		<script charset="UTF-8" src="js/tripledes.js"></script>
		<script charset="UTF-8" src="js/mode-ecb.js"></script>
		<script src="js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="js/zepto.min.js"></script>
		<script type="text/javascript" src="js/spin.min.js"></script>
		<script charset="UTF-8" src="js/mui.min.js"></script>
		<script src="js/jquery.qrcode.min.js"></script>
		<script src="js/qrcode.js"></script>
		<script src="js/jquery.qrcode.js"></script>
	</head>
	<style>
		.mui-bar{
			     padding-right: 0px; 
			     padding-left:0px; 
		}
	</style>
	<body>

		
		<header id="header" class="mui-bar mui-bar-transparent" style="width: 100%;">
				<div class="head-zhjf">
					<img src="images/fanhui@3x.png" class="ryjk-tx" onclick="fanhuis()">
					<div id="viewID">
						<div class="head-zhjf-img" onclick="addCowshedView()">
							<img src="images/tianjia-btn@3x.png">
						</div>
					</div>
					<p>牛舍管理</p>
				</div>
			
				<div class="search-div">
					<div class="g-bd2">
						<div class="search-l-div">
							<div class="seach-l-a">
								<img class="sousuo-acx" src="images/sousuo-btn@3x.png">
								<input id="CattleSeachDatacowLost" class="xtsz-search-btn" type="text" placeholder="请输入搜索内容" onfocus="if(value==defaultValue){value='';this.style.color='#393e46'}" onblur="if(!value){value=defaultValue;this.style.color='#cdcdcd'}">
			
							</div>
						</div>
						<div class="seach-r-div" onclick="houseListSeach()">
							<img class="cx-div" src="images/sousuo-a-btn@3x.png" />
						</div>
					</div>
				</div>
		</header>
		<div style="margin-top: 90px;" class="clear"></div>
		<div>
		<div id="noApplicationRecord">
			<div style="width: 100%;height: 100%;text-align: center;margin-top: 45%;">
				<img src="images/nodata.png" style="width: 200px;height: 140px;"/>
			</div>
		</div>
		</div>
		<div id="hddb" style="position: fixed;right: -63px;bottom: 30px;border-radius: 25px;width: 50px;height: 50px;text-align: center;">
			<img src="img/hddb.png" style="width: 32px;height: 32px;    margin-top: 9px;" onclick="goTop()">
		</div>
		<!--<div class="div-nsgl">
			<p class="nsgl-mc">0037号牛舍</p>
			
			<div class="nsgl-jd">
				<div class="jd-a" style="width: 45%;"></div>
				
			</div>
			<div class="syqk">
				<p class="nsgl-lb-l">已使用:7</p>
				<p class="nsgl-lb-r">剩余容量:5</p>
				<div class="clear"></div>
			</div>
		</div>-->
		<script>
			var noApplicationRecord = document.getElementById('noApplicationRecord');
			var viewID = document.getElementById('viewID');
			var CowtianjiaData = JSON.parse(localStorage.getItem('CowtianjiaData'));
			console.log(CowtianjiaData);
			var ToChangeIntoNumber = JSON.parse(localStorage.getItem('ToChangeIntoNumber'));
//			alert(ToChangeIntoNumber)
			if(ToChangeIntoNumber == 10) {
				function setDiv2(item) {
					var div = ''
					return div
				}
				function getnoApplicationData2() {
					var html = ''
					html += setDiv2()
					viewID.innerHTML = html
				}
				window.onload = getnoApplicationData2()
			} else {
				function setDiv1(item) {
					var div = '<div class="head-zhjf-img" onclick="addCowshedView()"><img src="images/tianjia-btn@3x.png"></div>'
					return div
				}
				function getnoApplicationData1() {
					var html = ''
					html += setDiv1()
					viewID.innerHTML = html
				}
				window.onload = getnoApplicationData1()
			}

			function setDiv(item) {
				var point = (item.use / item.capacity).toFixed(2);
				var str = Number(point * 100).toFixed(2);
				str += "%";
				if (item.capacity == undefined) {
					item.capacity=0;
				}
				var reduce = item.capacity - item.use;
				var div = '<div class="div-nsgl" id="' + item.houseID + '" onclick="Cowliebiao(this.id)"><p class="nsgl-mc">' +
					item.houseName +
					'</p><div class="nsgl-jd"><div class="jd-a" style="width:' +
					str +
					';"></div></div><div class="syqk"><p class="nsgl-lb-l">已使用:' +
					item.use +
					'</p><p class="nsgl-lb-r">剩余容量:' +
					reduce +
					'</p><div class="clear"></div></div></div>'
				return div
			}

			function getnoApplicationData() {
				var html = ''
				for(var i = 0; i < CowtianjiaData.length; i++) {
					html += setDiv(CowtianjiaData[i])
				}
				noApplicationRecord.innerHTML = html
			}
			if(CowtianjiaData.length != 0){
				window.onload = getnoApplicationData()
			}
			

			function fanhuis() {
				var ToChangeIntoNumber = JSON.parse(localStorage.getItem('ToChangeIntoNumber'));
				if(ToChangeIntoNumber == 10) {
					window.location = "4.转舍1.html";
				} else {
					FunctionList();
				}
			}
			function Cowliebiao(id) {
				var ToChangeIntoNumber = JSON.parse(localStorage.getItem('ToChangeIntoNumber'));
				if(ToChangeIntoNumber == 10) {
					for(var i = 0; i < CowtianjiaData.length; i++) {
						if(CowtianjiaData[i].houseID == id) {
							localStorage.setItem('ToChangeIntoDetails', JSON.stringify(CowtianjiaData[i]));
							window.location = "4.转舍1.html";
						}
					}
				} else {
					for(var i = 0; i < CowtianjiaData.length; i++) {
						if(CowtianjiaData[i].houseID == id) {
							localStorage.setItem('modifyCowshed', JSON.stringify(CowtianjiaData[i]));
						}
					}
					localStorage.setItem('CowshedNumber',JSON.stringify(0));
					console.log(id);
					window.location = "修改牛舍信息.html";
				}
			}
			function goTop(){
						    //速度
						    var speed = 100;
						    //开启定时器
						    
						    var timer = setInterval(function(){
						        //获取滚动条的高度
						        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
						        //设置滚动的高度
						        document.documentElement.scrollTop = document.body.scrollTop = (scrollTop - speed);
						        //清除定时器
						        speed += 30;
						        if(scrollTop <= 0){
						            clearInterval(timer);
						        }
						    },30)
						}
						
			function showLogin(){  
						    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
						    if (scrollTop > 0) {
						    	$("#hddb").css("right","-3px");
						    } else{
						    	$("#hddb").css("right","-63px");
						    } 
						    //每秒执行一次,showTime()  
						    setTimeout("showLogin()",500);  
						}
						showLogin()
		</script>
	</body>

</html>